package org.jerrymouse.jsa4j.vfs.local;

import org.jerrymouse.jsa4j.vfs.FileObject;
import org.jerrymouse.jsa4j.vfs.FileSystemManager;

public class LocalFileSystemManager implements FileSystemManager {
	private String basePath;

	// @Override
	// public FileObject getBaseFile() {
	// FileObject fileObject = new LocalFileObject(basePath);
	// return fileObject;
	// }

	@Override
	public FileObject resolveFile(FileObject directory, String name) {
		FileObject fileObject = new LocalFileObject(directory, name);
		return fileObject;
	}

	public void setBasePath(String basePath) {
		this.basePath = basePath;
	}

	public String getBasePath() {
		return basePath;
	}

	@Override
	public FileObject getBaseDirectory() {
		FileObject fileObject = new LocalFileObject(basePath);
		if (!fileObject.exists())
			fileObject.mkDir();
		return fileObject;
	}

}
